package com.excellent.ImageIdentification;

import java.io.File;
import java.io.FileInputStream;
import java.util.Base64;


public class ImageUtils {
    public static String encodeImageToBase64(String imagePath) throws Exception {
        File imageFile = new File(imagePath);
        FileInputStream imageStream = new FileInputStream(imageFile);
        byte[] imageData = new byte[(int) imageFile.length()];
        imageStream.read(imageData);
        return Base64.getEncoder().encodeToString(imageData);
    }
}